﻿/**
 * 请不要将该类库用于非法途径和商业途径，与此产生的一切法律后果与本人无关。
 * 有任何问题，可以访问我的博客：http://baiyafeng.com 留言
 * 使用本类库请遵循GPL v3协议。
 **/


using System;
using System.Collections.Generic;
 
using System.Text;
using System.Net;
using System.IO;
using SinaBlogQiangShafa.fetion;
 

namespace SinaBlogQiangShafa
{
  public static   class SmsFoFetion
    {
      private static readonly string mobile = System.Configuration.ConfigurationSettings.AppSettings["mobile"];
      private static readonly string mobile_pwd = System.Configuration.ConfigurationSettings.AppSettings["mobile_pwd"];

      public static void sendMessage(string message)
      {
          try
          { 
              Log.WriteInfo(string.Format("[{0}]:{1}", DateTime.Now.ToString(), "开始发送短消息"));
              Fetion fetion = new Fetion(mobile, mobile_pwd);
              fetion.Login();
              fetion.SendSMSToPhone(mobile, message);
              Log.WriteInfo( "短信提示发送成功");
          }
          catch (Exception err)
          {
              Log.WriteError(string.Format("[{0}]:{1}", DateTime.Now.ToString(), "短信发送失败,错误原因是：" + err.ToString()));
          }

      }

     

    }
}
